<?php
	include_once("../model/Acesso.class.php");
	include_once("../model/Mensagem.class.php");
	include_once("../model/Chamado.class.php");
	include_once("../model/Cliente.class.php");
	$acesso = new Acesso();
	$chamado = new Chamado();
	$cliente = new Cliente();
	$codigoPagina = "11";
	if ($acesso->verificaPermissaoUsuario($codigoPagina)){
		$banco = $acesso->getBanco();
		$id_chamado = $_REQUEST["id_chamado"];
		$dadosChamado = $chamado->getDadosChamado($banco,$id_chamado);
		$dadosChamado = mysql_fetch_row($dadosChamado);
		$idcliente = $dadosChamado[1];
		$dadosCliente = $cliente->getDadosClientes($banco,$idcliente);
		$dadosCliente = mysql_fetch_row($dadosCliente);
?>
<html>
<head>
<title>:.:.:INGECAMP:.:.:</title>
<link href="../arquivosExtra/estilo.css" rel="stylesheet" type="text/css">
<style type="text/css">
	body{
		background-color:#FFFFFF;
		background-image:none;
	}
</style>
<script language="javascript" src="../arquivosExtra/funcoesJavaScript.js"></script>
</head>

<body topmargin="0" leftmargin="0" onLoad="inserirDadosClienteChamado(<?php echo("$idcliente"); ?>,rua,numero,bairro,cidade,pontoref,telefone,email)">
<table width="100%" border="2" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#CCCCCC" class="letraCabecalho">SIG-INGECAMP- Sistema de Gerenciamento Geral - INGECAMP - Via Internet</td>
  </tr>
  <tr>
    <td height="21" align="center" valign="top">
<table width="100%" border="0" cellspacing="0">
        <tr> 
          <td height="57" valign="bottom"><table width="100%" border="0" cellspacing="0">
              <tr> 
                <td height="26" colspan="5" align="center" class="letraCampo"><img src="../imagens/logo.jpg" width="569" height="96"></td>
              </tr>
              <tr> 
                <td height="22" valign="bottom">&nbsp;</td>
                <td colspan="2" valign="middle">&nbsp;</td>
                <td valign="middle">&nbsp;</td>
                <td valign="bottom">&nbsp;</td>
              </tr>
              <tr> 
                <td width="12%" height="39" valign="bottom">&nbsp;</td>
                <td width="61%" valign="middle"> <div align="right"> 
                    <input type="button" name="Submit2" value="Pagina Principal" class="botaoUsuario2" onClick="Redireciona()">
                  </div></td>
                <td width="2%" valign="middle">&nbsp;</td>
                <td width="11%" valign="middle"><div align="center"> 
                    <input type="button" name="Submit223" value="Logoff" class="botaoUsuario2" onClick="formLogoff()">
                  </div></td>
                <td width="14%" valign="bottom">&nbsp;</td>
              </tr>
            </table></td>
        </tr>
      </table>
      <form name="form1" method="post" action="../control/controlExcluirChamado.php">
      	<input type="hidden" name="id_chamado" id="id_chamado" value="<?php echo("$id_chamado"); ?>">
        <table width="931" height="234" border="2" align="center" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="23%" height="21" bgcolor="#CCCCCC" class="letraCabecalho"> 
              <div align="center" class="letraCabecalho">Abertura de Ordem de Servi&ccedil;o </div></td>
          </tr>
          <tr> 
            <td height="172" align="left" valign="top"><table width="100%" border="0">
                <tr> 
                  <td height="21" align="right"><table width="100%" border="0">
                    <tr>
                      <td width="15%" align="right"><span class="letraCampo">Nome Fantasia:</span></td>
                      <td width="50%"><input name="cliente" type="text" class="caixaTexto" id="cliente" size="70" readonly="readonly" value="<?php echo("$dadosCliente[2]"); ?>"></td>
                      <td width="14%" align="right"><span class="letraCampo">Data da Chamado:</span></td>
                      <td width="21%"><input name="data" type="text" class="caixaTexto" id="data" onKeyPress="mascara(this, mdata)" size="15" maxlength="10" value="<?php $z = $acesso->getDataAcesso(); echo("$z"); ?>" readonly="readonly"></td>
                    </tr>
                  </table></td>
                </tr>
                <tr> 
                  <td height="15" align="right" class="letraCampo"><table width="100%" border="0">
                    <tr>
                      <td width="134" align="right" class="letraCampo">CNPJ:</td>
                      <td width="145"><input name="cnpj" type="text" class="caixaTexto" id="cnpj" onKeyPress="mascara(this, mcnpj)" value="<?php echo("$dadosCliente[3]"); ?>" size="20" maxlength="18" readonly="readonly"></td>
                      <td width="177" align="right" class="letraCampo">Inscri&ccedil;&atilde;o Estadual :</td>
                      <td width="270"><input name="inscricao_estadual" type="text" class="caixaTexto" id="inscricao_estadual" onKeyPress="mascara(this, minscest)" value="<?php echo("$dadosCliente[16]"); ?>" size="20" maxlength="15" readonly="readonly"></td>
                      <td width="3" align="right" class="letraCampo">&nbsp;</td>
                      <td width="164">&nbsp;</td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="15" align="right" class="letraCampo"><table width="100%" border="0">
                    <tr>
                      <td width="15%" align="right" class="letraCampo">Rua:</td>
                      <td width="36%"><input name="rua" type="text" class="caixaTexto" id="rua" size="50" maxlength="50" readonly="readonly"></td>
                      <td width="3%" align="right" class="letraCampo">N&ordm;:</td>
                      <td width="8%"><input name="numero" type="text" class="caixaTexto" id="numero" onKeyPress="mascara(this, mnum)" size="10" maxlength="8" readonly="readonly"></td>
                      <td width="9%" align="right" class="letraCampo">Bairro:</td>
                      <td width="29%"><input name="bairro" type="text" class="caixaTexto" id="bairro" size="30" maxlength="30" readonly="readonly"></td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="32" align="right" class="letraCampo"><table width="100%" border="0">
                    <tr>
                      <td width="15%" align="right" class="letraCampo">Cidade:</td>
                      <td width="24%"><input name="cidade" type="text" class="caixaTexto" id="cidade" size="30" maxlength="30" readonly="readonly"></td>
                      <td width="19%" align="right" class="letraCampo">Ponto de Refer&ecirc;ncia:</td>
                      <td width="42%"><input name="pontoref" type="text" class="caixaTexto" id="pontoref" size="50" readonly="readonly"></td>
                      </tr>
                  </table></td>
                </tr>
                <tr> 
                  <td height="21" align="right" class="letraCampo"><table width="100%" border="0">
                    <tr>
                      <td width="15%" align="right" class="letraCampo">Telefone:</td>
                      <td width="14%"><input name="telefone" type="text" class="caixaTexto" id="telefone" onKeyPress="mascara(this, mtel)" size="15" maxlength="14" readonly="readonly"></td>
                      <td colspan="2" align="right" class="letraCampo">Email:</td>
                      <td width="65%"><input name="email" type="text" class="caixaTexto" id="email" size="50" maxlength="50" readonly="readonly"></td>
                    </tr>
                    
                    
                  </table></td>
                </tr>
                <tr>
                  <td height="9" align="right" class="letraCampo"><table width="100%" border="0">
                    <tr>
                      <td width="15%" align="right" class="letraCampo">Prioridade:</td>
                      <td width="15%"><input name="prioridade" type="text" class="caixaTexto" id="prioridade" value="<?php echo("$dadosChamado[3]"); ?>" size="20" maxlength="20" readonly="readonly"></td>
                      <td width="7%" align="right" class="letraCampo">Status:</td>
                      <td width="14%"><input name="situacao" type="text" class="caixaTexto" id="situacao" value="<?php echo("$dadosChamado[4]"); ?>" size="20" maxlength="20" readonly="readonly"></td>
                      <td width="11%" align="right" class="letraCampo">Solicitante:</td>
                      <td width="38%"><input name="solicitante" type="text" class="caixaTexto" id="solicitante" value="<?php echo("$dadosChamado[6]"); ?>" size="50" maxlength="100" readonly="readonly"></td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="10" align="right" class="letraCampo"><table width="100%" border="0">
                    <tr>
                      <td width="15%" height="70" align="right" valign="top" class="letraCampo">Motivo:</td>
                      <td width="84%" valign="top"><textarea name="motivo" cols="140" rows="10" class="caixaTexto" id="motivo" readonly="readonly"><?php echo("$dadosChamado[5]"); ?></textarea></td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="21" align="right" class="letraCampo"><table width="100%" border="0">
                    <tr>
                      <td width="16%" align="right" class="letraCampo">Garantia:</td>
                      <td width="35%"><input name="garantia" type="text" class="caixaTexto" id="garantia" onKeyPress="mascara(this, mdata)" size="15" maxlength="10" value=""></td>
                      <td width="3%" align="right" class="letraCampo">N&ordm;:</td>
                      <td width="8%"><input name="numero2" type="text" class="caixaTexto" id="numero2" onKeyPress="mascara(this, mnum)" size="10" maxlength="8" readonly="readonly"></td>
                      <td width="9%" align="right" class="letraCampo">Bairro:</td>
                      <td width="29%"><input name="bairro2" type="text" class="caixaTexto" id="bairro2" size="30" maxlength="30" readonly="readonly"></td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="21" align="right" class="letraCampo">&nbsp;</td>
                </tr>
                <tr>
                  <td height="21" align="right" class="letraCampo">&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
          <tr> 
            <td height="37" align="left" valign="top"> <div align="center"> 
                <table width="100%" border="0">
                  <tr> 
                    <td width="47%" align="right"><input type="submit" name="Submit3" value="Cadastrar OS" class="botoes"></td>
                    <td width="5%">&nbsp;</td>
                    <td width="48%"> <input type="button" name="Submit3" value="Cancelar" class="botoes" onClick="Redireciona()"></td>
                  </tr>
                </table>
              </div></td>
          </tr>
        </table>
        <p>&nbsp;</p>
     </form>
      <p>&nbsp;</p>
  </tr>
  <tr>
    <td height="21" bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="0">
        <tr> 
           <td width="302" align="right"> 
            <input name="textfield" type="text" class="informacoesLogin" value="Usu&aacute;rio:  <?php $x = $acesso->getLoginUsuarioLogado(); echo("$x"); ?>" readonly="readonly"> 
          </td>
          <td width="17">&nbsp;</td>
          <td width="144"><input name="textfield2" type="text" class="informacoesLogin" value="Entrada &agrave;s:  <?php $y = $acesso->getHoraAcesso(); echo("$y"); ?>" readonly="readonly"></td>
          <td width="17">&nbsp;</td>
          <td width="303">
<input name="textfield22" type="text" class="informacoesLogin" value="Data: <?php $z = $acesso->getDataAcesso(); echo("$z"); ?>" readonly="readonly">
          </td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
<?php
}else{
		$msg = new Mensagem();
		$msg->informaMensagem(005,$acesso->getPaginaPrincipal());
	}?>